package com.tuni.birthdaymoney.persistence.entity;

// Generated 28.04.2013 16:40:29 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * BmRole generated by hbm2java
 */
@Entity
@Table(name = "BM_Role")
public class Role implements java.io.Serializable {

    private Integer id;
    private String description;
    private boolean add;
    private boolean delete;
    private boolean update;
    private Set<User> users = new HashSet<User>(0);

    public Role() {
    }

    public Role(String description, boolean add, boolean delete, boolean update) {
        this.description = description;
        this.add = add;
        this.delete = delete;
        this.update = update;
    }

    public Role(String description, boolean add, boolean delete, boolean update, Set<User> users) {
        this.description = description;
        this.add = add;
        this.delete = delete;
        this.update = update;
        this.users = users;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "ID", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "Description", nullable = false, length = 100)
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "Add_", nullable = false)
    public boolean isAdd() {
        return this.add;
    }

    public void setAdd(boolean add) {
        this.add = add;
    }

    @Column(name = "Delete_", nullable = false)
    public boolean isDelete() {
        return this.delete;
    }

    public void setDelete(boolean delete) {
        this.delete = delete;
    }

    @Column(name = "Update_", nullable = false)
    public boolean isUpdate() {
        return this.update;
    }

    public void setUpdate(boolean update) {
        this.update = update;
    }

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "role")
    public Set<User> getUsers() {
        return this.users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }

}
